package com.xyht.sca_s.student_manage_system.modules.trainingSchool.controller;


import com.xyht.sca_s.student_manage_system.common.annotation.RequestPass;
import com.xyht.sca_s.student_manage_system.common.commonReturn.CommonResult;
import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.sca_s.student_manage_system.modules.trainingSchool.entity.req.SmsTsChargeItemAmountReq;
import com.xyht.sca_s.student_manage_system.modules.trainingSchool.service.SmsTsChargeItemAmountService;
import com.xyht.sca_s.student_manage_system.modules.welcomeNewStudent.entity.req.SmsWnsIdListReq;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 收费项金额表 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2024-05-16
 */
@RestController
@SecretBody
@RequestMapping("/trainingSchool/chargeItemAmount")
public class SmsTsChargeItemAmountController {
    @Resource
    private SmsTsChargeItemAmountService smsTsChargeItemAmountService;

    @ApiOperation(value = "添加收费项金额")
    @PostMapping("/add")
    public ResponseResult add(@RequestBody SmsTsChargeItemAmountReq req) {
        return smsTsChargeItemAmountService.add(req);
    }

    @ApiOperation(value = "删除收费项金额")
    @PostMapping("/delete")
    public ResponseResult delete(@RequestBody SmsWnsIdListReq req) {
        smsTsChargeItemAmountService.removeByIds(req.getIdList());
        return CommonResult.success();
    }

    @ApiOperation(value = "修改收费项金额")
    @PostMapping("/update")
    public ResponseResult update(@RequestBody SmsTsChargeItemAmountReq req) {
        return smsTsChargeItemAmountService.update(req);
    }

    @ApiOperation(value = "收费项金额列表")
    @GetMapping("/detail")
    public ResponseResult detail(@RequestParam(value = "categoryId") String categoryId,
                                 @RequestParam(value = "levelId") String levelId) {
        return smsTsChargeItemAmountService.detail(categoryId, levelId);
    }

    @RequestPass
    @ApiOperation(value = "通过工种和级别获取收费项及金额")
    @GetMapping("/list")
    public ResponseResult list(@RequestParam(value = "jobId") String jobId,
                               @RequestParam(value = "levelId") String levelId) {
        return smsTsChargeItemAmountService.list(jobId, levelId);
    }

}

